{set:$seo_data=array();$site_config=new Config('site_config');$site_config=$site_config->getInfo();}
{set:$seo_data['title']="商品搜索_".$site_config['name']}
{set:seo::set($seo_data);}
{set:$defaultWhere = array('search' => $this->word , 'category_extend' => $this->cat_id )}
{set:$goodsObj = search_goods::find($defaultWhere);$resultData = $goodsObj->find();}

<div class="position"> <span>全部结果：</span> <a href="javascript:void(0)">{$this->word}</a> </div>
<div class="wrapper clearfix container_2">
	<div class="sidebar f_l">
		<div class="box_2 m_10">
			<div class="title">分类筛选</div>
			<div class="content">
				<dl class=" clearfix">
					{foreach:items=Api::run('getGoodsCategoryExtend',array('#word#',$this->word)) }
					{set:$tmpWord=urlencode($this->word);}
					<dd class='{if:IReq::get('cat') == $item['id']}current{/if}'><a href="{url:/site/search_list/word/$tmpWord/cat/$item[id]}">{$item['name']}({$item['num']})</a></dd>
					{/foreach}
				</dl>
			</div>
		</div>

	<!--热卖商品-->
		<div class="box m_10">
			<div class="title">热卖商品</div>
			<div class="content">
				<ul class="ranklist">
				{foreach:items=Api::run('getCommendHot')}
					<li class="current">
						<a href="{url:/site/products/id/$item[id]}"><img width="190px" height="190px" alt="{$item['name']}" src="{url:/pic/thumb/img/$item[img]/w/190/h/190}" /></a>
						<a title="{$item['name']}" class="p_name" href="{url:/site/products/id/$item[id]}">{$item['name']}</a>
						<b>￥{$item['sell_price']}</b>
					</li>
				{/foreach}
				</ul>
			</div>
		</div>
		<!--热卖商品-->
	</div>
	<div class="search_list main f_r">
		<strong class="result">"<span class="red">{$this->word}</span>" 搜索结果</strong>
		<p class="t_l gray m_10">你是不是想找：
			{foreach:items=Api::run('getKeywordByWord',array('#word#',$this->word)) }
			{set:$tmpWord=urlencode($item['word']);}
			<a href="{url:/site/search_list/word/$tmpWord}" class='orange'>{$item['word']}</a>
			{/foreach}
		</p>

		<!--商品条件检索-->
		<div class="box m_10">
			<div class="cont">

				<!--品牌展示-->
				{set:$brandList = search_goods::$brandSearch}
				{if:$brandList}
				<dl class="sorting">
					<dt>品牌：</dt>
					<dd id='brand_dd'>
						<a class="nolimit current" href="{echo:search_goods::searchUrl('brand','')}">不限</a>
						{foreach:items = $brandList}
						<a href="{echo:search_goods::searchUrl('brand',$item['id'])}" id='brand_{$item['id']}'>{$item['name']}</a>
						{/foreach}
					</dd>
				</dl>
				{/if}
				<!--品牌展示-->

				<!--商品属性-->
				{foreach:items = search_goods::$attrSearch}
				<dl class="sorting">
					<dt>{$item['name']}：</dt>
					<dd id='attr_dd_{$item['id']}'>
						<a class="nolimit current" href="{echo:search_goods::searchUrl('attr['.$item["id"].']','')}">不限</a>
						{foreach:items=$item['value'] item=$attr}
						<a href="{echo:search_goods::searchUrl('attr['.$item["id"].']',$attr)}" id="attr_{$item['id']}_{echo:urlencode($attr)}">{$attr}</a>
						{/foreach}
					</dd>
				</dl>
				{/foreach}
				<!--商品属性-->


				<!--商品价格-->
				<dl class="sorting">
					<dt>价格：</dt>
					<dd id='price_dd'>

						<a class="nolimit current" href="{echo:search_goods::searchUrl(array('min_price','max_price'),'')}">不限</a>
						{foreach:items=search_goods::$priceSearch}
						{set:$priceZone = explode('-',$item)}
						<a href="{echo:search_goods::searchUrl(array('min_price','max_price'),array($priceZone[0],$priceZone[1]))}" id="{$priceZone[0]}-{$priceZone[1]}">{$item}</a>
						{/foreach}
					</dd>
				</dl>
				<!--商品价格-->
			</div>
		</div>
		<!--商品条件检索-->
		<!--排序-->
		<div id="filter">
		<div class="cls"></div>
		<div class="fore1">
			<dl class="order"><dt>排序：</dt>
				{foreach:items=search_goods::getOrderType()}
					{set:$next = search_goods::getOrderValue($key)}
					<dd class="{echo:search_goods::isOrderCurrent($key) ? 'curr':''} {echo:search_goods::isOrderDesc() ? 'down':'up'}">
					<a href="{echo:search_goods::searchUrl('order',$next)}">{$item}</a><b></b></dd>
				{/foreach}
			</dl>
		</div>
		</div>
		<!--排序-->

		{if:$resultData}
		{set:$listSize = search_goods::getListSize(IFilter::act(IReq::get('show_type')))}
		<ul class="list-h_hl clearfix m_10">
			{foreach:items=$resultData}

			<li index="1" sku="1297041994" selfservice="0">
				<div class="lh-wrap">
					<div class="p-img">
						<a target="_blank" href="{url:/site/products/id/$item[id]}" >
						<img width="220" height="220" alt="{$item['name']}" src="{url:/pic/thumb/img/$item[img]/w/220/h/220}" title="{$item['name']}">
						</a>
					</div>
					<div class="p-name">
						<a target="_blank" href="{url:/site/products/id/$item[id]}"  title="{$item['name']}">
						{$item['name']}
						</a>
					</div>
					<div class="p-price">
						<strong>￥{$item['sell_price']}</strong>
						<del>￥{$item['market_price']}</del>
					</div>
					<div class="extra">
						<span class="evaluate"><a target="_blank" href="{url:/site/products/id/$item[id]}">已有{$item['comments']}人评价</a></span>
					</div>
					<div class="btns">
						<a target="_blank" href="{url:/site/products/id/$item[id]}" class="btn-buy">查看详情</a>
						<a href="javascript:void(0);" class="btn-buy" onclick="favorite_add_ajax('{url:/simple/favorite_add}','{$item['id']}',this);">收藏</a>
					</div>
				</div>
				</li>

			{/foreach}
		</ul>
		{$goodsObj->getPageBar()}
		{else:}
		<p class="display_list mt_10" style='margin-top:50px;margin-bottom:50px'>
			<strong class="gray f14">对不起，没有找到相关商品</strong>
		</p>
		{/if}
	</div>
</div>

<script type='text/javascript'>
//价格检查
function checkPrice(obj)
{
	if(isNaN(obj.value))
	{
		obj.value = '';
	}
}

//筛选条件按钮高亮
jQuery(function(){
	{set:
		$brand = IFilter::act(IReq::get('brand'),'int');
	}

	{if:$brand}
	$('#brand_dd>a').removeClass('current');
	$('#brand_{$brand}').addClass('current');
	{/if}

	{set:$tempArray = IFilter::act(IReq::get('attr'),'url')}
	{if:$tempArray}
		{set:$json = JSON::encode(array_map('md5',$tempArray))}
		var attrArray = {$json};
		for(val in attrArray)
		{
			if(attrArray[val])
			{
				$('#attr_dd_'+val+'>a').removeClass('current');
				document.getElementById('attr_'+val+'_'+attrArray[val]).className = 'current';
			}
		}
	{/if}

	{if:IReq::get('min_price') != ''}
	$('#price_dd>a').removeClass('current');
	$('#{echo:IReq::get('min_price')}-{echo:IReq::get('max_price')}').addClass('current');
	{/if}
});
</script>